package com.tucc.hello.leetcode.no1_400.no201_400.no201;

/**
 * @author tucc
 * @description todo
 * @package com.tucc.hello.leetcode
 * @date 2021/5/20
 **/
public class Solution {

    public static void main(String[] args) {
        Solution solution = new Solution();
        // 110
        // 101
        // 111
        // 1000
        //
        // 100 = 4
        System.out.println(solution.rangeBitwiseAnd(4, 7));
    }

    public int rangeBitwiseAnd(int left, int right) {
        while(right > left){
            right &= (right - 1);
            System.out.println(right);
        }
        return right;
    }
}
